package Data1;

import java.awt.Color;

import javax.swing.JPanel;

public class OneJPrame extends JPanel implements Runnable{
	
	int x=200,y=100;
	
	Thread t;
	
	public OneJPrame(){
		setBackground(Color.BLACK);
		t=new Thread(this);
		t.start();
	}
	
	public void paint(java.awt.Graphics g ){
		super.paint(g);
		g.setColor(Color.white);
		g.fillOval(100, 100,100 ,100 );
		g.setColor(Color.BLACK);
		g.fillOval(x, y, 100, 100);
	}

	@Override
	public void run() {
		// TODO Auto-generated method stub
		while(true){
			x--;
			if(x==99){
				x=200;
			}
			repaint();
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
